package field_REGEX_Definitions.IFAfields;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import field_REGEX_Definitions.Field;
import fields.*;

public class Name_on_Card implements Field{
	private Pattern nameOnCard = Pattern.compile("[\\n\\s]*name on card(.*)",Pattern.CASE_INSENSITIVE);
	private String field;
	private String type = "IFA";
	
	public boolean matches(String input) {
		Matcher matcher = nameOnCard.matcher(input);
		boolean result = matcher.find();
		if (result) {
			field = "Name on Card";
		}
		return result;
	}
	
	public String getFieldName(){
		return field;
	}

	public CreditCard execute() {
		return new CreditCard(field,"IFA");
	}
	
	public String getFieldType() {
		return type;
	}
}
